package algorithm;

public class SelectSort {
    static void sort(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            int low = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[j] < arr[low]) {
                    low = j;
                }
            }
            if (low != i) {
                int temp = arr[i];
                arr[i] = arr[low];
                arr[low] = temp;
            }
        }
    }
    public static void main(String[] args) {
        int[] arr = {70,30,40,10,80,20,90,100,75,60,45};
        sort(arr);
        for (int i = 0; i <arr.length ; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
